<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="keywords" content="汽车商城-选购你的第一辆车">
    <meta name="description" content="汽车商城-选购你的第一辆车">
    <link rel="shortcut icon" href="../../auto/favicon.ico" type="image/x-icon">
    <title>汽车商城--助你选购爱车</title>
    <link rel="stylesheet" href="/auto/lib/Swiper-3.4.2/css/swiper.css">
    <link rel="stylesheet" href="/auto/font/font-awesome-4.7.0/css/font-awesome.css">
    <link rel="stylesheet" href="/auto/Css/base.css">
    <link rel="stylesheet" href="/auto/Css/index.css">
    <link rel="stylesheet" href="/admin/assets/css/layui.css">
    <script src="/admin/qrcode/jquery2.1.4.js"></script>
    <script src="/admin/layer/layer.js"></script>
</head>

<body>
<!-- top bar -->
<div class="top_bar">
    <div class="top_bar_con">
        <div class="top_bar_left">
            <img src="/auto/images/logo.png" alt="">
            <img src="/auto/images/slogan.svg" alt="">
        </div>
        <div class="top_bar_search clearfix">
            <form action="">
                <input type="text" class="search-input" name="keyword" placeholder="搜索品牌、车型等" id="search-input">
                <i class="fa fa-search "></i>
                <input type="submit" id="query" class="search-btn" value="搜索" bosszone="search">
            </form>
        </div>
        <div class="top_bar_right">
            <a href="/end/auto/index.html" class="active">首页</a>
            <a href="/end/auto/VehicleScre.html">选车</a>
            <a href="/end/auto/Personal.html" id="userCollect">我的收藏</a>
            <button id="loading">请登录</button>
            <a href="javascript:;" id="user"></a>
            <button id="loginOut">退出</button>
        </div>
    </div>
</div>
<!-- 轮播图 -->
<div class="shuffling_fig">
    <div class="swiper-container">
        <div class="swiper-wrapper">
            <div class="swiper-slide">
                <img src="/auto/images/benchi.jpg" alt="">
            </div>
            <div class="swiper-slide">
                <img src="/auto/images/benchi.jpg" alt="">
            </div>
            <div class="swiper-slide">
                <img src="/auto/images/20002.jfif" alt="">
            </div>
            <div class="swiper-slide">
                <img src="/auto/images/20003.jfif" alt="">
            </div>
            <div class="swiper-slide">
                <img src="/auto/images/20004.jfif" alt="">
            </div>
            <div class="swiper-slide">
                <img src="/auto/images/20005.jfif" alt="">
            </div>
        </div>
        <!-- 如果需要分页器 -->
        <div class="swiper-pagination"></div>
    </div>
    <div class="con_screen">
        <div class="screen_brand">
            <p>品牌</p>
            <span>
                    <a href="/end/auto/VehicleScre.html?f1=大众">大众</a>
                </span>
            <span>
                    <a href="/end/auto/VehicleScre.html?f1=别克">别克</a>
                </span>
            <span>
                    <a href="/end/auto/VehicleScre.html?f1=雪佛兰">雪佛兰</a>
                </span>
            <span>
                    <a href="/end/auto/VehicleScre.html?f1=东风日产">东风日产</a>
                </span>
            <div class="all_brand">
                <a href="/end/auto/VehicleScre.html?f1=大众">
                    <img src="/auto/images/20151215_160129_67597110_thumbnail_100_100.png" alt="">
                    <span>大众</span>
                </a>
                <a href="/end/auto/VehicleScre.html?f1=起亚">
                    <img src="/auto/images/20151215_161048_90655720_thumbnail_100_100.png" alt="">
                    <span>起亚</span>
                </a>
                <a href="/end/auto/VehicleScre.html?f1=丰田">
                    <img src="/auto/images/20141125_210003_68440110_thumbnail_100_100.png" alt="">
                    <span>丰田</span>
                </a>
                <a href="/end/auto/VehicleScre.html?f1=奥迪">
                    <img src="/auto/images/20141125_212218_70114440_thumbnail_100_100.png" alt="">
                    <span>奥迪</span>
                </a>
                <a href="/end/auto/VehicleScre.html?f1=别克">
                    <img src="/auto/images/20141125_211622_34479610_thumbnail_100_100.png" alt="">
                    <span>别克</span>
                </a>
                <a href="/end/auto/VehicleScre.html?1=宝马">
                    <img src="/auto/images/20141125_211841_27250090_thumbnail_100_100.png" alt="">
                    <span>宝马</span>
                </a>
                <a href="/end/auto/VehicleScre.html?f1=标志">
                    <img src="/auto/images/20141210_152916_12209520_thumbnail_100_100.png" alt="">
                    <span>标志</span>
                </a>
                <a href="/end/auto/VehicleScre.html?f1=雪铁龙">
                    <img src="/auto/images/20160531_093241_16392690_thumbnail_100_100.gif" alt="">
                    <span>雪铁龙</span>
                </a>
                <a href="/end/auto/VehicleScre.html?f1=现代">
                    <img src="/auto/images/20141125_195026_51928610_thumbnail_100_100.png" alt="">
                    <span>现代</span>
                </a>
                <a href="/end/auto/VehicleScre.html?f1=福特">
                    <img src="/auto/images/20141125_205939_97625230_thumbnail_100_100.png" alt="">
                    <span>福特</span>
                </a>
                <a href="/end/auto/VehicleScre.html?f1=长城">
                    <img src="/auto/images/20141125_211334_11221720_thumbnail_100_100.png" alt="">
                    <span>长城</span>
                </a>
                <a href="/end/auto/VehicleScre.html?f1=本田">
                    <img src="/auto/images/20141125_211749_28233010_thumbnail_100_100.png" alt="">
                    <span>本田</span>
                </a>
            </div>
        </div>
        <div class="screen_model">
            <p>价格</p>
            <span>
                    <a href="/end/auto/VehicleScre.html?price2=100000">10万以下</a>
                </span>
            <span>
                    <a href="/end/auto/VehicleScre.html?price1=100000&price2=150000">10-15万</a>
                </span>
            <span>
                    <a href="/end/auto/VehicleScre.html?price2=200000&price1=150000">15-20万</a>
                </span>
            <span>
                    <a href="/end/auto/VehicleScre.html?price2=300000&price1=200000">20-30万</a>
                </span>
            <span>
                    <a href="/end/auto/VehicleScre.html?price2=500000&price1=300000">30-50万</a>
                </span>
            <span>
                    <a href="/end/auto/VehicleScre.html?price1=500000&price2=0">50万以上</a>
                </span>
        </div>
        <div class="screen_model">
            <p>级别</p>
            <span>
                    <a href="/end/auto/VehicleScre.html?r1=SUV">SUV</a>
                </span>
            <span>
                    <a href="/end/auto/VehicleScre.html?r1=小型车">小型车</a>
                </span>
            <span>
                    <a href="/end/auto/VehicleScre.html?r1=紧凑型车">紧凑型车</a>
                </span>
            <span>
                    <a href="/end/auto/VehicleScre.html?r1=中型车">中型车</a>
                </span>

            <span>
                    <a href="/end/auto/VehicleScre.html?r1=大中型车">大中型车</a>
                </span>
            <span>
                    <a href="/end/auto/VehicleScre.html?r1=MPV">MPV</a>
                </span> <br>
            <span>
                    <a href="/end/auto/VehicleScre.html?r1=跑车">跑车</a>
                </span>

        </div>
    </div>
</div>
<!--  -->
<div class="pro_long_fig">
    <a href="javascript:;">
        <img src="/auto/images/0.jfif" alt="">
    </a>
</div>
<!-- 享优选 -->
<div class="select_models">
    <div class="select_mod_top">
        <p>智能选车</p>
        <span>为您选择，喜欢车型</span>
    </div>
    <div class="select_mod_main">
        <a href="/end/auto/VehicleScre.html?price=100000&price2=150000">
            <img src="/auto/images/249251.jpg" alt=""></a>
        <a href="/end/auto/VehicleScre.html">
            <img src="/auto/images/123412.png" alt=""></a>
        <a href="/end/auto/VehicleScre.html?r1=SUV">
            <img src="/auto/images/249253.jpg" alt=""></a>
    </div>
</div>
<div class="featured_product">
    <div class="select_mod_top">
        <p>时尚推荐</p>
        <span>点击即可查看更多</span>
    </div>
    <div class="select_mod_main">
        <a href="javascript:;">
            <img src="/auto/images/0 (1).jfif" alt="">
        </a>
        <a href="javascript:;">
            <img src="/auto/images/0 (2).jfif" alt="">
        </a>
        <a href="javascript:;">
            <img src="/auto/images/0 (3).jfif" alt="">
        </a>
    </div>
</div>
<!-- 大众优选 -->
<div class="public_pre">
    <div class="select_mod_top">
        <p>大众优选</p>
        <span>为您推荐最合适的选择</span>
    </div>
    <div class="public_pre_main ">
        <div>
            <img src="/auto/images/249255.jpg" alt="" style="width:230px;height:322px">
        </div>
        <div class="public_con">
            <label>现金直降20000元</label>
            <h4>上汽大众帕萨特</h4>
            <span>2020款 280TSI 双离合 商务版 国VI</span>
            <img src="/auto/images/c313bfc9b0f44c408c195f1486783df7.png" alt="">
            <p>¥18.18万</p>
            <a href="javascript:;">查看详情></a>
        </div>
        <div class="public_con ">
            <label>现金直降41000元</label>
            <h4>上汽大众途观L</h4>
            <span> 330TSI 自动两驱舒享版</span>
            <img src="/auto/images/1996000c4e1a40d78e76d036e643d576.png" alt="">
            <p>¥21.58万</p>
            <a href="/end/auto/product.html?id=6">查看详情></a>
        </div>
        <div class="public_con">
            <label>现金直降25000元</label>
            <h4>东风雪铁龙C3-XR</h4>
            <span>2021款 C3-XR 1.2THP 双离合 190THP 致尚版</span>
            <img src="/auto/images/edd061e332184164871ef020676033b9.png" alt="">
            <p>¥8.89万</p>
            <a href="javascript:;">查看详情></a>
        </div>
        <div class="public_con">
            <label>现金直降59000元</label>
            <h4>大众朗逸</h4>
            <span>2022款 1.5L 自动舒适版</span>
            <img src="/auto/images/5dc831d58ea34affbd5b7d09f20eac36.png" alt="">
            <p>¥11.29万</p>
            <a href="/end/auto/product.html?id=5">查看详情></a>
        </div>

    </div>
</div>

<!-- 预约试驾 -->
<div class="public_pre">
    <div class="select_mod_top">
        <p>预约试驾</p>
        <span>最新车型 进店享试驾</span>
    </div>
    <div class="public_pre_main">
        <div class=" mess_opt">
            <img src="/auto/images/249257.jpg" alt="" style="width:230px;height:322px">
        </div>
        <div class="public_con mess_opt">
            <label>购车有礼</label>
            <h4>大众品牌旗舰店</h4>
            <span>全新一代朗逸</span>
            <img src="/auto/images/72499.png" alt="">
            <p>1元抵9388元</p>
            <a href="javascript:;">进店试驾></a>
        </div>
        <div class="public_con mess_opt">
            <label>敬请期待</label>
            <h4>凯迪拉克旗舰店</h4>
            <span>CT5</span>
            <img src="/auto/images/248393.png" alt="">
            <p>敬请期待</p>
            <a href="javascript:;">进店下订></a>
        </div>
        <div class="public_con mess_opt">
            <label>试驾有礼</label>
            <h4>别克品牌旗舰店</h4>
            <span>轿车家族</span>
            <img src="/auto/images/248849.png" alt="">
            <p>试驾享精美礼品</p>
            <a href="javascript:;">进店试驾></a>
        </div>
        <div class="public_con mess_opt">
            <label>敬请品鉴</label>
            <h4>雪佛兰品牌旗舰店</h4>
            <span>新探界者</span>
            <img src="/auto/images/248848.png" alt="">
            <p>敬请品鉴</p>
            <a href="javascript:;">进店试驾></a>
        </div>

    </div>
</div>

<!-- 首页底部 -->
<div class="bottom_bar">
    <div class="custom_ser">
        <div class="custom_ser_main">
            <div>
                <span>周一至周五</span><br>
                <span>9:00-17:00</span>
            </div>
            <div>
                <h4>175-3012-3061</h4>
                <p>商城客服热线</p>
            </div>
            <div>
                <img src="/auto/images/1210339.png" alt="">
            </div>
            <div>
                <h3>扫码享权益</h3>
                <p>优惠随时掌握</p>
            </div>
        </div>
    </div>
    <div class="about_us">
        <div class="about_us_main">
            <ul>
                <li>
                    <a href="#">关于我们</a>
                </li>
                <li>
                    <a href="#">About Us</a>
                </li>
                <li>
                    <a href="#">隐私政策</a>
                </li>
                <li>
                    <a href="#">联系我们</a>
                </li>
                <li>
                    <a href="#">客服中心</a>
                </li>
            </ul>
            <br>
            <p>Copyright © 2021 - 2022 Car Shop. All Rights Reserved</p>
            <p>汽车商城 版权所有</p>
        </div>
    </div>
</div>
<!-- 登录页面 -->
<div class="land_page_back">
    <div class="land_page">
        <div class="land_page_con">
            <div class="land_page_top">
                <p>💁‍♂️ 密码登录</p>
                <a href="#" id="load_close">✕</a>
            </div>
            <div class="land_page_main">
                <input id="phone" placeholder="请输入手机号" type="tel" maxlength="50" autocomplete="tel" name="account"
                       value="">
                <input id="pas_input" placeholder="请输入密码" type="password" maxlength="50" autocomplete="tel"
                       name="account" value="">
                <img id="eye_img" src="/auto/images/close.png" alt="">
                <button type="button" id="login">登录</button>
            </div>
            <div class="land_page_bottom">
                <a href="#" id="click_register">没有账号？点击注册</a> <br>
                <p>登录即表示你同意<a href="#">用户协议</a>和<a href="#">隐私条款</a></p>
            </div>
        </div>
    </div>
    <div class="register">
        <div class="land_page">
            <div class="land_page_con">
                <div class="land_page_top">
                    <p>🙆‍♂️ 注册账号</p>
                    <!-- <a href="#" id="load_close">✕</a> -->
                </div>
                <div class="land_page_main register_main">
                    <input placeholder="请输入手机号" id="addPhone" type="tel" maxlength="50" autocomplete="tel"
                           name="account"
                           value="">
                    <input placeholder="请输入用户名" id="addName" type="tel" maxlength="50" autocomplete="tel" name="account"
                           value="">
                    <input id="pas1" placeholder="请输入密码" type="password" maxlength="50" autocomplete="tel"
                           name="account" value="">
                    <img id="eye1" src="/auto/images/close.png" alt="">
                    <input id="pas2" placeholder="确认密码" type="password" maxlength="50" autocomplete="tel"
                           name="account" value="">
                    <img id="eye2" src="/auto/images/close.png" alt="">
                    <label>
                        <p>注册即表示你同意<a href="#">用户协议</a>和<a href="#">隐私条款</a></p>
                    </label>
                    <button type="button" id="userAdd">点击注册</button>
                </div>
                <div class="land_page_bottom">
                    <a href="#" id="return_log">↺返回登录</a> <br>
                </div>
            </div>
        </div>
    </div>
</div>
<!-- 销量榜 -->
<div class="sales_list">
    <div class="sales_head">
        收藏榜
    </div>
    <ul id="collect">

    </ul>
</div>
<script src="/auto/lib/jquery/1.11.3/jquery.min.js"></script>
<script src="/auto/lib/Swiper-3.4.2/js/swiper.js"></script>
<script>
    var mySwiper = new Swiper('.swiper-container', {
        direction: 'horizontal',

        loop: true,
        autoplay: 2000,
        autoplayDisableOnInteraction: false,


        // 如果需要分页器
        pagination: '.swiper-pagination',
        paginationClickable: true,

        // 如果需要前进后退按钮
        nextButton: '.swiper-button-next',
        prevButton: '.swiper-button-prev',

        // 如果需要滚动条
        //   scrollbar: '.swiper-scrollbar',
    })
</script>
<!-- 登录 -->
<script>
    var load = document.querySelector('.top_bar .top_bar_right #loading');
    var closePage = document.getElementById('load_close');

    var land_page = document.querySelector('.land_page_back');
    var reg_btn = document.getElementById('click_register');
    var login_page = document.querySelector('.land_page_back .land_page');
    var registerPage = document.querySelector('.land_page_back .register');
    var return_log = document.getElementById('return_log');
    console.log(load, closePage, land_page, reg_btn, login_page);
    load.onclick = function () {
        land_page.style.display = 'block';
    }
    closePage.onclick = function () {
        land_page.style.display = 'none';
    }
    reg_btn.onclick = function () {
        login_page.style.display = 'none';
        registerPage.style.display = 'block';
    }
    return_log.onclick = function () {
        login_page.style.display = 'block';
        registerPage.style.display = 'none';
    }

    // 控制密码是否可见
    // 登录 一个
    let eyeImg = document.getElementById('eye_img');
    let pasInput = document.getElementById('pas_input');

    let flag = false;
    eyeImg.onclick = function () {
        flag = !flag;
        if (flag) {
            eyeImg.src = '/auto/images/open.png';
            pasInput.type = 'text';
        } else {
            eyeImg.src = '/auto/images/close.png';
            pasInput.type = 'password';
        }
    }

    // 注册两个
    let eye1 = document.getElementById('eye1');
    let pas1 = document.getElementById('pas1');

    let flag1 = false;
    eye1.onclick = function () {
        flag1 = !flag1;
        if (flag1) {
            eye1.src = '/auto/images/open.png';
            pas1.type = 'text';
        } else {
            eye1.src = '/auto/images/close.png';
            pas1.type = 'password';
        }
    }

    let eye2 = document.getElementById('eye2');
    let pas2 = document.getElementById('pas2');

    let flag2 = false;
    eye2.onclick = function () {
        flag2 = !flag2;
        if (flag2) {
            eye2.src = '/auto/images/open.png';
            pas2.type = 'text';
        } else {
            eye2.src = '/auto/images/close.png';
            pas2.type = 'password';
        }
    }

    let login = document.getElementById('login');
    let userAdd = document.getElementById('userAdd');
    let loginOut = document.getElementById('loginOut');

    //判断是否登录
    $(function () {
        $.ajax({
            type: "POST",
            url: "/Login/LoginBy",
            data: "",
            dataType: "json",
            success: function (data) {
                if (data.code === 200) {
                    $("#loading").hide();
                    $("#user").html(data.obj.userName);
                } else {
                    $("#loginOut").hide();
                    $("#userCollect").hide();
                }
            }
        })
    })

    //登录
    login.onclick = function () {
        let phone = $("#phone").val();
        let password = $("#pas_input").val();
        var windowId = layer.load()
        $.ajax({
            type: "POST",
            url: "/Login/userLogin",
            data: {phone: phone, password: password},//主要是分页和多条件参数数据
            dataType: "json",
            success: function (data) {
                //关闭弹窗
                layer.close(windowId);
                //显示结果和跳转页面
                layer.msg(data.msg)
                if (data.code === 200) {
                    location.reload()
                }
            }
        })
    }

    //注册
    userAdd.onclick = function () {
        let addName = $("#addName").val();
        let addPhone = $("#addPhone").val();
        let pwd1 = $("#pas1").val();
        let pwd2 = $("#pas2").val();
        if (pwd1 !== pwd2 || pwd1 === null || pwd2 === null) {
            alert("两次密码不匹配，或密码为空了");
        } else if (addName === null) {
            alert("用户名不能为空！")
        } else if (addPhone === null) {
            alert("手机号不能为空！")
        } else {
            $.ajax({
                type: "POST",
                url: "/Views/userAdd",
                data: {phone: addPhone, userName: addName, passWord: pwd1},
                dataType: "json",
                success: function (data) {
                    if (data.code === 200) {
                        alert("注册成功,请登录")
                        location.reload(true);
                    } else if (data.code === 500) {
                        alert(data.msg);
                    } else {
                        alert(data.msg);
                    }
                }
            })
        }
    }

    loginOut.onclick = function () {
        $.ajax({
            type: "post",
            url: "/Login/userLogout",
            data: "",
            dataType: "json",
            success: function (data) {
                alert(data.msg);
                location.reload(true);
            }
        })
    }

    $(function () {
        $.ajax({
            type: "POST",
            url: "/Views/queryByTen",
            data: "",
            dataType: "json",
            success: function (data) {
                let list = data;
                let str = "";
                for (var i = 1; i <= list.length; i++) {
                    let a = list[i-1];
                    let picture = a.picture;
                    let priceMin = a.priceMin != "" ? a.priceMin/10000 : 0;
                    priceMin = priceMin.toFixed(2);
                    let priceMax = a.priceMax != "" ? a.priceMax/10000 : 0;
                    priceMax = priceMax.toFixed(2);
                    str += '<li>' +
                        '<a href="/end/auto/product.html?id='+a.id+'">' +
                        '<div>' + i + '</div>' +
                        '<div>' +
                        '<p>' + a.carName + '</p>' +
                        '<span>' + priceMin+' - '+ priceMax + '万元</span>' +
                        '</div>' +
                        '<div>' +
                        '<img src="/assets/images/carName/'+picture+'" width="70px" height="50px">'+
                        '</div>' +
                        '</a> </li>'
                }
                str+='<li></li>'
                $("#collect").html(str);
            }
        })
    })
</script>
<!-- 搜索功能 -->
<script>

</script>
</body>

</html>